import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-06
 * Time: 03:32
 */
class Solution {
    public static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> list = new ArrayList<>();
        List<Integer> row = new ArrayList<>();
        row.add(1);
        list.add(row);
        for (int i = 1; i < numRows; i++) {
            List<Integer> curRow = new ArrayList<>();
            curRow.add(1);
            List<Integer> preRow = list.get(i - 1);
            for (int j = 1; j < i; j++) {
                int x = preRow.get(j) + preRow.get(j - 1);
                curRow.add(x);
            }
            curRow.add(1);
            list.add(curRow);
        }
        return list;
    }
}

public class yanghuisanjiao {
    public static void main(String[] args) {

        List<List<Integer>> list =Solution.generate(10);
        System.out.println(list);
    }
}
